#include "cameracontrolrequest.h"
#include "cryptstring.h"

const char values[14]={"udlr1234nfios"};

CameraControlRequest::CameraControlRequest(const QString &url): _url(url), _speed(67), _step(1), _channelId(1)
{

}

void CameraControlRequest::setUrl(const QUrl &url)
{
    _url = url;
}

void CameraControlRequest::setChannelId(uint32_t channelId)
{
    _channelId = channelId;
}

void CameraControlRequest::setStep(int step)
{
    _step = step;
}

void CameraControlRequest::setSpeed(int speed)
{
    _speed = speed;
}

QString CameraControlRequest::getMoveUrl(MoveCommand command)
{
    KVQuery parametersKV;
    parametersKV.add("channelId", QString::number(_channelId));
    parametersKV.add("value", QString(values[command]));
    parametersKV.add("speed", QString::number(_speed));
    QString paramerters = parametersKV.getParameters(); // url中'?'与协议类型之间的参数字符串
    QUrl moveUrl(_url);
    moveUrl.setQuery(paramerters);
    return moveUrl.toString();
}
